<?php
namespace app\common\wx;

use app\common\httpdown\HttpRequest;
use app\common\wx\Token;

class Temp{        
    /**
    * 获取小程序模板库标题列表
    */
    public function mylist($originalid,$offset,$count){
        $token =  new Token();        
        $url = 'https://api.weixin.qq.com/cgi-bin/wxopen/template/list?access_token='.$token->getAccessToken($originalid);
        $http = new HttpRequest();
        $data = array("offset"=>$offset,"count"=>$count);
        return json_decode($http->https_request($url,toJson($data)),true);
    }

    public function sendTemplate($originalid,$data){
        $token =  new Token();        
        $url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token='.$token->getAccessToken($originalid);
        $http = new HttpRequest();        
        return json_decode($http->https_request($url,toJson($data)),true);
    }
}